﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MockPrjTeam1.Biz;

namespace MockPrjTeam1.Pages.Views
{
    public partial class PremiseList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void GetAllPremise(object sender, EventArgs e)
        {
            if (ckbInActive.Checked)
            {
                var biz = new PremiseBiz();
                var results = biz.GetAllPremise();
                grvPremise.DataSource = results;
                grvPremise.DataBind();
            }
            else
            {
                var biz = new PremiseBiz();
                var results = biz.GetActivePremise();
                grvPremise.DataSource = results;
                grvPremise.DataBind();
            }
        }
        protected void PageChanging(object sender, GridViewPageEventArgs e)
        {
            if (ckbInActive.Checked)
            {
                var biz = new PremiseBiz();
                var results = biz.GetAllPremise();
                grvPremise.PageIndex = e.NewPageIndex;
                grvPremise.DataSource = results;
                grvPremise.DataBind();
            }
            else
            {
                var biz = new PremiseBiz();
                var results = biz.GetActivePremise();
                grvPremise.PageIndex = e.NewPageIndex;
                grvPremise.DataSource = results;
                grvPremise.DataBind();
            }
        }
       

    }
}